<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      数值A: <input type="text" v-model="a" />
      <br />
      数值B: <input type="text" v-model="b" @keyup.enter="calculate" />
      <br />
      <button @click="calculate">计算</button>
      <br />
      计算结果：{{ result }}
    </div>

    <script src="../vue.js"></script>
    <script>
      var app = new Vue({
        el: '#app',
        data: {
          a: '',
          b: '',
          result: '',
        },
        methods: {
          calculate() {
            this.result = parseFloat(this.a) + parseFloat(this.b);
          },
        },
      });
    </script>
  </body>
</html>
